package com.ittao.taopicture.domain.picture.valueobject;

import lombok.Getter;

/**
 * 图片分类枚举
 */
@Getter
public enum PictureCategoryEnum {

    NATURE("nature", "自然风景"),
    PORTRAIT("portrait", "人物肖像"),
    ARCHITECTURE("architecture", "建筑"),
    ANIMAL("animal", "动物"),
    FOOD("food", "美食"),
    TECHNOLOGY("technology", "科技"),
    ART("art", "艺术"),
    OTHER("other", "其他");

    private final String text;
    private final String value;

    PictureCategoryEnum(String text, String value) {
        this.text = text;
        this.value = value;
    }

    /**
     * 根据 value 获取枚举
     */
    public static PictureCategoryEnum getEnumByValue(String value) {
        if (value == null) {
            return null;
        }
        for (PictureCategoryEnum categoryEnum : PictureCategoryEnum.values()) {
            if (categoryEnum.value.equals(value)) {
                return categoryEnum;
            }
        }
        return null;
    }
}
